package com.qf.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.entity.dto.GoodsSku;
import com.qf.mapper.GoodsSkuMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class GoodsSkuService extends ServiceImpl<GoodsSkuMapper,GoodsSku> {

    @Transactional(readOnly = true)
    public List<GoodsSku> getSkuListByGoodsId(Long goodsId) {
        QueryWrapper<GoodsSku> wrapper = new QueryWrapper<>();
        wrapper.lambda().eq(GoodsSku::getGoodsId,goodsId)
                        .orderByDesc(GoodsSku::getOrderNum);
        return this.list(wrapper);
    }
}
